package com.omp.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.orm.Page;

import com.omp.common.dao.CommonDAO;
import com.omp.dao.UserLevelDAO;
import com.omp.entity.UserLevel;
import com.omp.service.UserLevelService;

@Service
@Transactional
public class UserLevelServiceImpl implements UserLevelService{
	
	@Autowired
	private CommonDAO commonDAO;
	@Autowired
	private UserLevelDAO userLevelDAO;

	@Override
	public void batchDelete(List<Integer> ids) {
		if (ids != null && ids.size() > 0) {
			for (Integer id : ids) {
				userLevelDAO.deleteById(id);
			}
		}
		
	}

	@Override
	public void delete(Integer id) {
		userLevelDAO.deleteById(id);
		
	}

	@Override
	public UserLevel findById(Integer id) {
		return (UserLevel) commonDAO.findById(UserLevel.class, id);
	}

	@Override
	public Page<UserLevel> findByPage(Page<UserLevel> page, UserLevel userLevel) {
		return userLevelDAO.findByPage(page, userLevel);
	}

	@Override
	public boolean nameExists(String name) {
		return userLevelDAO.nameExists(name);
	}

	@Override
	public void save(UserLevel userLevel) {
		commonDAO.save(userLevel);
		
	}

	@Override
	public void update(UserLevel userLevel) {
		commonDAO.update(userLevel);
		
	}

}
